/**
 * Created by binLee on 2016/7/26.
 */
var selectListShow = 0;
$(function(){
    $("#type,.searchselectbtn").click(function(){
        if (selectListShow){
            $("#selectTypeList").slideUp("fast");
            selectListShow = 0;
        }else{
            $("#selectTypeList").slideDown("fast");
            selectListShow = 1;
        }
        return false;
    });
    $("body").click(function(){
        if (selectListShow){
            $("#selectTypeList").slideUp("fast");
            selectListShow = 0;
        }
    });
    $(".searchselect li").click(function(){
        $("#type").text($(this).text());
        $("#type").attr("typename",$(this).attr("typename"));
        $(this).parent().hide();
        $("#fulltextSearch").click();
    });
    bar_highlight();// 导航条高亮
});

function bar_highlight(){
    var $templateAPI = $("#dsp_templateType").val();
    switch($templateAPI){
        case "dsp_guidepage" :
            $("#navigation_bar_1").parent("li").addClass("high-light-bar");
            break;
        case "dsp_recommendedpage" :
            $("#navigation_bar_2").parent("li").addClass("high-light-bar");
            break;
        case "dsp_PGpage" :
            $("#navigation_bar_3").parent("li").addClass("high-light-bar");
            break;
        case "dsp_economicpage" :
            $("#navigation_bar_4").parent("li").addClass("high-light-bar");
            break;
        case "dsp_paperpage" :
            $("#navigation_bar_5").parent("li").addClass("high-light-bar");
            break;
        case "paper_detailpage" :
            $("#navigation_bar_5").parent("li").addClass("high-light-bar");
            break;
        case "dsp_paperLayout" :
            $("#navigation_bar_5").parent("li").addClass("high-light-bar");
            break;
        case "dsp_magazinepage" :
            $("#navigation_bar_6").parent("li").addClass("high-light-bar");
            break;
		case "dsp_magazineLayout" :
			$("#navigation_bar_6").parent("li").addClass("high-light-bar");
			break;
		case "magazine_detailpage" :
			$("#navigation_bar_6").parent("li").addClass("high-light-bar");
			break;
        default : // 除了栏目页外的其他页面
            second_col_highlight();
            break;
    }
}

function second_col_highlight(){
    var aDOM = $("#page_position").find("a[id^='postion_col']");
    var aNum = aDOM.length;
    if(aNum>0){  // 稿件详情页、二级页面高亮

        var aDOMId = aDOM.first().attr("id");
        switch(aDOMId){
            case "postion_col1" :
                $("#navigation_bar_1").parent("li").addClass("high-light-bar");
                break;
            case "postion_col2" :
                $("#navigation_bar_2").parent("li").addClass("high-light-bar");
                break;
            case "postion_col3" :
                $("#navigation_bar_3").parent("li").addClass("high-light-bar");
                break;
            case "postion_col4" :
                $("#navigation_bar_4").parent("li").addClass("high-light-bar");
                break;
            case "postion_col5" :
                $("#navigation_bar_5").parent("li").addClass("high-light-bar");
                break;
            case "postion_col6" :
                $("#navigation_bar_6").parent("li").addClass("high-light-bar");
                break;
        }

    }else{ // 其他页面默认高亮首页
        $("#navigation_bar_1").parent("li").addClass("high-light-bar");
    }
}


